#!/usr/bin/node

console.log('09-pid is :', process.pid);

const cp = require('child_process');
//spawn进程分离

var child = cp.spawn('./03-child.js', [], {datach:true, stdio:['ignore', 1, 2]});

//child.stdout.pipe(process.stdout);
//child.stderr.pipe(process.stderr);
child.unref();

//主进程5秒后退出
setTimeout(() => { 
  console.log('5 seconds passed,主进程退出');
  process.exit(0);
}, 5000);

//主进程退出后，子进程就不运行了
